package Server.Poker.SSZLIU;

import java.util.Random;

import Server.Model.Base.IServerUserItem;

public class Constants {
	

	public static final int INVALID_CHAIR = 255;
	public static final int STAGE_NULL = 0;
	public static final int STAGE_FAPAI = 1;

	public static final int STAGE_JIESUAN = 5;
	
	// 扑克类型
	public static final int SUB_S_GAME_START = 100; // 游戏开始

	public static final int SUB_S_ADD_GOLD = 101; // 加注结果
	public static final int SUB_S_GIVE_UP = 102; // 放弃跟注
	public static final int SUB_S_SEND_CARD = 103; // 发牌消息
	public static final int SUB_S_GAME_END = 104; // 游戏结束
	public static final int SUB_S_KAIPAI = 105; // 开牌 //add
	public static final int SUB_S_KANPAI = 106; // 看牌 //add
	public static final int SUB_S_OVER = 107; // add

	public static final int SUB_GF_SCENE = 111;
	public static final int SUB_GF_SIT = 112;
	public static final int SUB_GF_STANDUP = 113;

	public static final int GAME_KIND = 13;
	public static final int INIT_TOTAL = 0; // 牌局全部清空
	public static final int INIT_FIRST_ROUND = 1; // 牌局全部清空
	public static final int INIT_NEWROUND = 2; // 为了下一把初始化一些东西

	public static final int sizeof(long[] m_LookOnUserID) {
		return m_LookOnUserID.length;
	}

	public static void memset(long[] by, int by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = (long) by2;
		}

	}
	public static int countof(int[] by,int by2) {
		int cntCount = 0;
		for (int i = 0; i < by.length; i++) {
			if (by[i] == by2) {
				cntCount++;
			}
		}
		return cntCount;
	}
	public static Random rd = new Random();

	public static final int rand() {
		return rd.nextInt(1000);
	}

	public static int rand(int i, int j) {
		return  rand(i,j,0);
	}
	public static final int rand(int i, int j, int factor) {
		return rd.nextInt(j - i) + i;
	}

	public static void CopyMemory(int[] by, int by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2;
		}
	}

	public static void CopyMemory(int[] by, int[] by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2[i];
		}
	}

	public static void memcpy(int[] by, int[] by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2[i];
		}
	}

	public static void memset(int[] by, int by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2;
		}
	}

	public static final int CountArray(int by[]) {
		return by.length;
	}

	public static final int sizeof(int[] m_byParam) {
		return m_byParam.length;
	}

	public static final int sizeof(IServerUserItem[] m_pIUserItem) {
		return m_pIUserItem.length;
	}

	//////////////////////////////////////////////////////////////////////////
	// 消息结构体
	// 用户状态定义
	public static final int US_NULL = 0x00; // 没有状态
	public static final int US_READY = 0x01; // 同意状态
	public static final int US_PLAY = 0x02; // 游戏状态

	public static final int US_FREE = 0x10; // 站立状态
	public static final int US_SIT = 0x11; // 坐下状态
	public static final int US_LOOKON = 0x12; // 旁观状态
	public static final int US_OFFLINE = 0x13;
	public static final int GS_FREE = 0;
	public static final int GS_PLAYING = 100;
	public static final int GAME_END_DISMISS = 4;
	public static final int GAME_END_NORMAL = 0;

	public static int GER_NORMAL		=			0x00	;							//常规结束
	public static int GER_DISMISS		=			0x01	;							//游戏解散
	public static int GER_USER_LEFT		=			0x02	;							//用户离开	
	public static int GER_NO_PLAYER = 0x10; // 没有玩家
	
	public static int atoi(String string) {
		try {
			return Integer.parseInt(string);
		} catch (Exception e) {

		}
		return 0;
	}

	public static int sizeof(SSeatInfo[] m_seatInfo) {
		return m_seatInfo.length;
	}

	public static void memset(SSeatInfo[] m_seatInfo, int by2, int sizeof) {
		for (int i = 0; i < m_seatInfo.length; i++) {
			m_seatInfo[i] = new SSeatInfo();
		}
	}

	public static long time(Object object) {
		return System.currentTimeMillis();
	}

	public static final int CT_SINGLE		 = 			1;	  							//单牌类型
	public static final int CT_ONE_LONG		 = 			2;								//对子类型
	public static final int CT_TWO_LONG		 = 			3;								//两对类型
	public static final int CT_THREE_TIAO	 = 			4;								//三条类型
	public static final int CT_SHUN_ZI		 = 			5;								//顺子类型
	public static final int CT_TONG_HUA		 = 			6;								//同花类型
	public static final int CT_HU_LU		 = 			7;								//葫芦类型
	public static final int CT_TIE_ZHI		 = 			8;								//铁支类型
	public static final int CT_TONG_HUA_SHUN = 			9;								//同花顺型
	public static final int CT_KING_TONG_HUA_SHUN = 	10; 							//皇家同花顺
	public static final int CT_WU_TONG = 	11; 							            //五同
	
	
	public static final int CT_ZHIZUNQINGLONG		 = 			11;	  							//至尊青龙
	public static final int CT_YITIAOLONG		 = 			12;								//一条龙
	public static final int CT_SITAOSANTIAO		 = 			13;								//四套三条
	public static final int CT_LIUDUIBAN	 = 			14;								//六对半
	public static final int CT_SANSHUNZI		 = 			15;								//三顺子
	public static final int CT_SANTONGHUA		 = 			16;								//三同花
	
}
